<%@page import="java.rmi.Remote"%>
<%@ page language="java" import="java.util.*,mySql.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="show_shop.*" %>
<%@ page import="java.sql.PreparedStatement"%>
<%@ page import="java.sql.ResultSet"%>
<%@ page import="java.sql.Connection"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>search</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	<link rel="stylesheet" type="text/css" href="css/show.css">


	<script>
	function test()
	{
		alert("请先登录");
	}
	</script>


  </head>
  
  <body>
   <!-- header begin -->
   <div class="header">
	<div class="top-header">
	<div class="phone">
	<ul>
	<li class="tele"></li>
	<li class="telenum">
	<p>13739477470</p>
	</li>
	</ul>
	</div>
	
	<div class="logo">
	<h1><a href="http://localhost:8080/practise/index.jsp">Welcome</a></h1>
	</div>
	
	<div class="login_shopcar">
	<%
		user_bean user=new user_bean();
		user=(user_bean)session.getAttribute("feng");
		if(user!=null)
		{
			out.print("欢迎您:"+user.getUsername());		
		%>
			<br><a href="http://localhost:8080/practise/jsp/cancel.jsp" class="cancel">注销</a>
		<% 
		}
		else
		{
	%> 
	<div class="left">
		<div class="left_1"><a href="http://localhost:8080/practise/jsp/login.jsp">Login</a></div>
	</div>
	<% }
	%>
	<div class="right">
	<%
	
		if(user!=null)
		{
	 %>
	<span class="shopcar_money">
	 $0.00 
	</span>
	<a href="http://localhost:8080/practise/jsp/shop_car.jsp?id=500">
	<img src="image/bag.png"/></a>
	<%
		}		
		else
		{
	 %>
			<a onclick="test()">
		<img src="image/bag.png"/></a>
	<%
		}
	 %>
	</div>
	</div>
</div>
   </div>
   <!-- header end -->
   
   <!-- banner begin -->
   <div class="top_banner">
   <div class="navigation">
   <ul>
   <li><a href="http://localhost:8080/practise/jsp/head.jsp">首页</a></li>
   <li><a href="#">外国菜</a></li>
   <li><a href="#">中国菜</a></li>
   <li><a href="#">外国零食</a></li>
   <li><a href="#">中国零食</a></li>
   <li><a href="#">关于我们</a></li>
   </ul>
   </div>
 
 <div class="bottom_banner">
 <div class="content_input">
 <form>
 <span><input type="text" name="key_word"></span>
	<input type="submit" value="Search" style="background:#F52B00;">
 </form>
 </div>

 </div>
   </div>
   <!-- banner end -->
   
   <!-- body_content begin -->
   <div class="all">
   
   
   <% 
   			String login_name="root";
			String login_password="2014121167";
			String driverClass="com.mysql.jdbc.Driver";
			String url="jdbc:mysql://localhost:3306/test";
			Connection con=null;
			PreparedStatement pst=null;
			ResultSet rs=null;
   			ArrayList<goods_bean> goods=new ArrayList<goods_bean>();
   			DBConnection dbcon=new DBConnection(driverClass,url,login_password,login_name);
   			try
   			{
   					con=dbcon.getConnection();
   					pst=con.prepareStatement("select * from goods_detail  Where name="+"'"+new String(request.getParameter("key_word").getBytes("iso8859-1"), "utf-8")+"'");			
   					rs=pst.executeQuery();
   					System.out.println(new String(request.getParameter("key_word").getBytes("iso8859-1"), "utf-8"));
   					while(rs.next())
   					{
   						//System.out.println(rs.getString(1));
   						goods_bean search=new goods_bean();
   						search.setPicture(rs.getString(1));
   						search.setName(rs.getString(2));
   						search.setPrice(rs.getString(3));
   						goods.add(search);
   					}
   					session.setAttribute("feng_goods", goods);
   			
   			}
 			catch (Exception e) {
				e.getStackTrace();
			}	
   		  
   		goods=(ArrayList<goods_bean>)session.getAttribute("feng_goods");
   	
   		int i=0;
   	
   	
   		if(goods==null)
   		{
   		
   		System.out.println("Goods is Null");
   		}

   
   %>
   
 <div id="show_new_area" class="clearfix">
 
 	<!-- one begin -->
      <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=0"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=0" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
                    

         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        
        <!-- one end -->
        
        <!-- two begin -->
     <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=1"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=1" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
                    

         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- two end -->
        
        <!-- three begin -->
    <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=2"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=2" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
                    

         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!--  three end -->
        
        <!-- four begin -->
      <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=3"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=3" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
                    

         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- four end -->
        
        <!-- five begin -->
       <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=4"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=4" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
                    

         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- five end -->
</div>   
    <div id="show_new_area" class="clearfix">
    
    <!-- six begin -->
         <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=5"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=5" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- six end -->
        
        <!-- seven begin -->
       <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=6"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=6" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- seven end -->
        
        <!-- eight begin -->
        <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=7"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=7" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- eight end -->
        
        <!-- nine begin -->
       <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=8"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=8" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>                    
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- nine end -->
        
        <!-- ten begin -->
       <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=9"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=9" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>                  
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- ten end -->
</div>   

	<!-- eleven begin -->
    <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=10"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=10" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>                    
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- eleven end -->
        
        <!-- twelve begin -->
       <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=11"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jspid=11" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>                   
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- twelve end -->
        
        <!-- thirteen begin -->
        <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=12"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=12" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>                    
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- thirteen end -->
        
        <!-- fourteen begin -->
       <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jspid=13"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=13" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>                    
         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- fourteen end -->
        
        <!-- fifteen begin -->
       <div class="goodsItem">
    <%
      if(i<goods.size()) 
      {	%>
			  <a href="http://localhost:8080/practise/jsp/pay.jsp?id=14"><img src="
			   <%
           			out.print(goods.get(i).getPicture());
          		  %>
			  "  class="goodsimg"></a><br>
       <p class="f1"><a href="http://localhost:8080/practise/jsp/pay.jsp?id=14" title="Top with ribbed neckline">
			<% 
           			out.print(goods.get(i).getName());
            %>
			</a></p>
                    

         价格：<font class="f1">
				<% 
           			out.print(goods.get(i).getPrice());
           			i++;
            %>  
            <% }
     %> 
         </font>      	    
        </div>
        <!-- fifteen end -->
</div>   

   
   
   
   
   </div>
   <!-- body_content end -->
   
   <!-- bottom begin -->
   <div class="bottom_show">
   <div class="picture_1">
 	<a href="#"></a>
   </div>
   <div class="picture_2">
 <a href="#"></a>
   </div>   
   <div class="picture_3">
  <a href="#"></a>
   </div>
    <div class="picture_4">
  <a href="#"></a>
   </div>
   
   
   </div>
      <div class="bottom_bar"></div>
   <div class="bottom_word">
	<p>航空港校区 | 四川省成都市西南航空港经济开发区学府路一段24号 | 右边610225 | 电话:028-85966502</p>
	<p>龙泉校区 | 成都市龙泉驿阳光城幸福路10号 | 邮编:610103 | 电话:028-84833333</p>
	<p>Copyringht 2003_2014 成都信息工程大学 建议使用IE8.0,1034*860以上浏览</p>
   </div>
   <!-- bottom end -->
   
  </body>
</html>
